/*
 * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
 *
 * https://www.mall4j.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */
package com.yami.shop.groupbuy.api.controller;

import com.yami.shop.common.response.ServerResponseEntity;
import com.yami.shop.groupbuy.common.api.dto.ApiGroupTeamDto;
import com.yami.shop.groupbuy.common.service.GroupTeamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 小懒虫
 * @date 2019/9/2 9:01
 */
@RestController
@RequestMapping("/group")
@Api(tags = "团购信息接口")
public class GroupController {

    @Autowired
    private GroupTeamService groupTeamService;


    @GetMapping("/joinGroupList")
    @ApiOperation(value = "可加入的团列表", notes = "只显示最近n个团列表(默认10)")
    public ServerResponseEntity<List<ApiGroupTeamDto>> joinGroupList(
            @ApiParam(value = "拼团活动ID", required = true) @RequestParam("groupActivityId") Long groupActivityId,
            @ApiParam(value = "显示数量（默认10）") @RequestParam(value = "showSize", defaultValue = "10") Integer showSize) {
        List<ApiGroupTeamDto> list = groupTeamService.listJoinGroup(groupActivityId, showSize);
        return ServerResponseEntity.success(list);
    }
}
